<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return redirect('user/index');
});
Route::any('user/register', 'User\UserIndexController@userRegister');
Route::any('user/login', 'User\UserIndexController@userLogin');
Route::get('404', 'User\UserIndexController@notFound');
//用户登陆路由组，前缀、命名空间以及中间件！
Route::group(['prefix' => 'user','namespace' => 'User', 'middleware' => 'user_login'], function () {
    Route::any('index', 'UserIndexController@index');
    Route::post('get_list', 'UserIndexController@getList');
    Route::post('init', 'GatewayEventsController@init');
    Route::post('change_sign', 'UserIndexController@changeSign');
    Route::any('info', 'UserIndexController@uInfo');

    Route::any('find', 'UserIndexController@find');
    //查找界面下查看好友和群组信息
    Route::get('look_friend/{frID}', 'UserIndexController@lookFriend');
    Route::get('look_group/{grID}', 'UserIndexController@lookGroup');
    Route::any('add_friend/{tid}','UserIndexController@addFriend');
    //消息盒子
    Route::get('msgbox','UserIndexController@msgbox');
    Route::post('msgbox_noread', 'UserIndexController@msgGetNoRead');
    Route::post('msgbox_readed', 'UserIndexController@msgReaded');
    Route::any('agree_friend/{tid}','UserIndexController@agreeFriend');
    Route::post('refuse_friend', 'UserIndexController@refuseFriend');
    Route::get('get_group_members', 'UserIndexController@getMembers');
    // layim 聊天接口
    Route::get('chatlogs', 'UserIndexController@getChatlogs');
    Route::post('upload_chat_img', 'UserIndexController@uploadChatImg');
    Route::post('upload_chat_file', 'UserIndexController@uploadChatFile');

    //好友右键菜单
    Route::get('friend_info/{frID}', 'UserIndexController@getFriendInfo');
    Route::any('friend_record/{toID}', 'UserIndexController@getFriendRecord');
    Route::post('delete_friend', 'UserIndexController@deleteFriend');
    Route::post('shield', 'UserIndexController@shield');
    Route::any('report_friend/{frID}', 'UserIndexController@reportFriend');
    Route::any('gzone/{frID}', 'UserIndexController@lookGzone');
    Route::post('move_group', 'UserIndexController@moveFriendGroup');

    //群组右键菜单
    Route::get('group_info/{grID}', 'UserIndexController@getGroupInfo');
    Route::get('group_profile/{grID}', 'UserIndexController@getGroupProfile');
    Route::post('leave_group', 'UserIndexController@leaveGroup');
    Route::any('report_group/{grID}', 'UserIndexController@reportGroup');
    Route::any('group_record/{toID}', 'UserIndexController@getGroupRecord');

    //好友分组右键菜单
    Route::post('create_friend_group', 'UserIndexController@createFriendGroup');
    Route::post('delete_friend_group', 'UserIndexController@deleteFriendGroup');
    Route::post('rename_friend_group', 'UserIndexController@renameFriendGroup');


    //主面板右键菜单
    Route::post('logout','UserIndexController@logout');
    Route::post('switch','UserIndexController@switch');

    //群组
    Route::any('add_group/{gid}','UserIndexController@addGroup');
    Route::any('create_group','UserIndexController@createGroup');
    Route::post('agree_group','UserIndexController@agreeGroup');
    Route::post('refuse_group','UserIndexController@refuseGroup');

    //上传文件
    Route::post('upavatar', 'UserIndexController@upAvatar');

    //用户中心
    Route::get('center', 'UserIndexController@center');
    Route::any('center_data', 'UserIndexController@getCenterJSON');
    Route::any('change_pwd', 'UserIndexController@changePwd');
    Route::post('logout', 'UserIndexController@logout');
    Route::post('change_group_info', 'UserIndexController@changeGroupInfo');

    Route::post('destroy_group', 'UserIndexController@destroyGroup');

});